package com.yjy.config;

import com.yjy.Interceptor.JWTInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    
    @Resource
    private JWTInterceptor jwtInterceptor;
    
    //加自定义拦截器JWTInterceptor,设置拦截规则
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtInterceptor).addPathPatterns("/**")
            .excludePathPatterns("/login","/register","/files/download/**");
    }

//    @Bean
//    public JWTInterceptor jwtInterceptor() {
//        return new JWTInterceptor();
//    }
}